package com.im.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.im.MDA;
import com.im.service.dto.BaseException;
import com.im.service.dto.InvestPlan;
import com.im.service.dto.InvestStatic;
import com.im.service.dto.PageQuery;
import com.im.service.dto.PlanDeclareSet;
import com.im.service.dto.Staff;
import com.im.service.investPlan.smo.IInvestPlanOperSMO;
import com.im.service.investPlan.smo.IInvestPlanQuerySMO;
import com.im.util.JsonUtil;
import com.im.util.ReturnsUtil;
import com.im.util.StringUtil;
import com.im.viewmodel.fundPlan.InvestPlanRspVo;

import net.sf.json.JSONObject;

@RestController
@RequestMapping("/investPlanService")
public class InvestPlanService {

	private static final Logger logger = LogManager.getLogger(InvestPlanService.class);
	@Autowired
	private IInvestPlanQuerySMO investQuerySmo;
	@Autowired
	private IInvestPlanOperSMO investOperSmo;

	/**
	 * 投资计划申报设置列表查询
	 * 
	 * @param inJson
	 * @return
	 */
	@RequestMapping(value = "/queryInvestPlanSetList", method = RequestMethod.POST)
	@ResponseBody
	public String queryInvestPlanSetList(@RequestBody String inJson) {
		if (logger.isInfoEnabled()) {
			logger.info("查询投资计划申报设置列表请求入参json:{}", inJson);
		}
		if (inJson == null || inJson.length() <= 0) {
			throw new BaseException("请求json入参为空，请核查数据!");
		}
		try {
			PageQuery<PlanDeclareSet> planDeclareSets = investQuerySmo.queryInvestPlanSetList(inJson);
			String result = ReturnsUtil.returnSuccess(planDeclareSets).toString();
			return result;
		} catch (Exception e) {
			logger.error(e.getMessage());
			return ReturnsUtil.returnException("查询投资计划申报设置失败！", e).toString();
		}
	}

	/**
	 * 投资计划申报设置详情查询
	 * 
	 * @param inJson
	 * @return
	 */
	@RequestMapping(value = "/queryInvestPlanSetDetail", method = RequestMethod.POST)
	@ResponseBody
	public String queryInvestPlanSetDetail(@RequestBody String inJson) {
		if (logger.isInfoEnabled()) {
			logger.info("查询投资计划申报设置详情请求入参json:{}", inJson);
		}
		try {
			String declareSetId = JsonUtil.obtainValueFromJsonObject(inJson, "declareSetId");
			PlanDeclareSet declareSet = new PlanDeclareSet();
			declareSet.setDeclareSetId(declareSetId);
			Map<String, Object> paramMap = new HashMap<String, Object>();
			paramMap.put("declareSet", declareSet);
			PlanDeclareSet planDeclareSet = investQuerySmo.queryInvestPlanSetDetail(paramMap);
			String result = ReturnsUtil.returnSuccess(planDeclareSet).toString();
			return result;
		} catch (Exception e) {
			logger.error(e.getMessage());
			return ReturnsUtil.returnException("查询投资计划申报设置失败！", e).toString();
		}
	}

	@RequestMapping(value = "/queryProjectAndTotalFoundSource", method = RequestMethod.POST)
	@ResponseBody
	public String queryProjectAndTotalFoundSource(@RequestBody String inJson) {
		if (logger.isInfoEnabled()) {
			logger.info("入参json:{}", inJson);
		}
		try {
			String impleProjId = JsonUtil.obtainValueFromJsonObject(inJson, "impleProjId");
			String declareType = JsonUtil.obtainValueFromJsonObject(inJson, "declareType");
			List<JSONObject> list = investQuerySmo.queryProjectAndTotalFoundSource(impleProjId, declareType);
			String result = ReturnsUtil.returnSuccess(list).toString();
			return result;
		} catch (Exception e) {
			logger.error(e.getMessage());
			return ReturnsUtil.returnException("查询失败！", e).toString();
		}
	}

	@RequestMapping(value = "/queryDeclareSetIds", method = RequestMethod.POST)
	@ResponseBody
	public String queryDeclareSetIds(@RequestBody String inJson) {
		if (logger.isInfoEnabled()) {
			logger.info("入参json:{}", inJson);
		}
		try {
			String declareType = JsonUtil.obtainValueFromJsonObject(inJson, "declareType");
			String type = "";
			if ("10".equals(declareType)) {
				type = "30";
			}
			if ("20".equals(declareType)) {
				type = "40";
			}
			if(inJson.contains("hasYearDt")){
                return ReturnsUtil.returnSuccess(investQuerySmo.queryDeclareSetIdsForList(type)).toString();
            }else {
                //Map<String, String> map = investQuerySmo.queryDeclareSetIds(type);
                return ReturnsUtil.returnSuccess(investQuerySmo.queryDeclareSetIds(type)).toString();

            }
		} catch (Exception e) {
			logger.error(e.getMessage());
			return ReturnsUtil.returnException("查询失败！", e).toString();
		}
	}
	/**
	 * 投资计划填报列表查询
	 * 
	 * @param inJson
	 * @return
	 */
	@RequestMapping(value = "/queryInvestPlanList", method = RequestMethod.POST)
	@ResponseBody
	public String queryInvestPlanList(@RequestBody String inJson) {
		if (logger.isInfoEnabled()) {
			logger.info("查询投资计划填报列表请求入参json:{}", inJson);
		}
		if (inJson == null || inJson.length() <= 0) {
			throw new BaseException("请求json入参为空，请核查数据!");
		}
		try {
			List <String> typelist=new  ArrayList<String>();
			typelist.add(MDA.FUND_PLAN_STATUS_CD_WRITE.toString());
			typelist.add(MDA.FUND_PLAN_STATUS_CD_FIR.toString());
			typelist.add(MDA.FUND_PLAN_STATUS_CD_WAIT.toString());
			typelist.add(MDA.FUND_PLAN_STATUS_CD_PASS.toString());
			typelist.add(MDA.FUND_PLAN_STATUS_CD_FIR_REFUSE.toString());
			PageQuery<InvestPlanRspVo> result = investQuerySmo.queryInvestPlanListNew(inJson, typelist);
			return ReturnsUtil.returnSuccess(result).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}

	/**
	 * 投资计划初审列表查询
	 * 
	 * @param inJson
	 * @return
	 */
	@RequestMapping(value = "/queryInvestPlanTrialList", method = RequestMethod.POST)
	@ResponseBody
	public String queryInvestPlanTrialList(@RequestBody String inJson) {
		if (logger.isInfoEnabled()) {
			logger.info("查询投资计划初审列表请求入参json:{}", inJson);
		}
		if (inJson == null || inJson.length() <= 0) {
			throw new BaseException("请求json入参为空，请核查数据!");
		}
		try {
			List<String> typelist = new ArrayList<String>();
			typelist.add(MDA.FUND_PLAN_STATUS_CD_WAIT.toString());
			PageQuery<InvestPlanRspVo> result = investQuerySmo.queryInvestPlanListNew(inJson, typelist);
			return ReturnsUtil.returnSuccess(result).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}

	/**
	 * 投资计划批复列表查询
	 * 
	 * @param inJson
	 * @return
	 */
	@RequestMapping(value = "/queryInvestPlanAlignList", method = RequestMethod.POST)
	@ResponseBody
	public String queryInvestPlanAlignList(@RequestBody String inJson) {
		if (logger.isInfoEnabled()) {
			logger.info("查询投资计划批复列表请求入参json:{}", inJson);
		}
		if (inJson == null || inJson.length() <= 0) {
			throw new BaseException("请求json入参为空，请核查数据!");
		}
		try {
			List<String> typelist = new ArrayList<String>();
			typelist.add(MDA.FUND_PLAN_STATUS_CD_FIR.toString());
			//PageQuery<InvestPlan> result = investQuerySmo.queryInvestPlanList(inJson, typelist);
			PageQuery<InvestPlanRspVo> result = investQuerySmo.queryInvestPlanListNew(inJson, typelist);
			return ReturnsUtil.returnSuccess(result).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}

	/**
	 * 投资计划填报详情查询
	 * 
	 * @param inJson
	 * @return
	 */
	@RequestMapping(value = "/queryInvestPlanDetail", method = RequestMethod.POST)
	@ResponseBody
	public String queryInvestPlanDetail(@RequestBody String inJson) {
		if (logger.isInfoEnabled()) {
			logger.info("查询投资计划填报详情请求入参json:{}", inJson);
		}
		try {
			InvestPlan result = investQuerySmo.queryInvestPlanDetail(inJson);
			return ReturnsUtil.returnSuccess(result).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}

	/**
	 *
	 * 新增投资计划申报设置
	 * 
	 * @param jsonStr
	 *            入参
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/addInvestPlanSet", method = RequestMethod.POST)
	public String addInvestPlanSet(HttpServletRequest request,@RequestBody String jsonStr) throws Exception {
		if (logger.isInfoEnabled()) {
			logger.info("新增投资计划申报设置请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("新增投资计划申报设置请求json入参为空，请核查数据!");
			}
			HttpSession session = request.getSession();
			Staff staff = (Staff) session.getAttribute("loginedStaff");
			String result = investOperSmo.addInvestPlanSet(jsonStr, staff);
			JSONObject jsonObj = JSONObject.fromObject(result);
			String resultCode = JsonUtil.getStringFromJSON(jsonObj, "resultCode", "");
			if (MDA.RESULT_SUCCESS.equals(resultCode)) {
				return result;
			} else {
				return ReturnsUtil.returnFailure(JsonUtil.obtainValueFromJsonObject(result, "message"));
			}
		} catch (BaseException e) {
			if (logger.isErrorEnabled()) {
				logger.error(e.getStackTrace());
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnException("新增投资计划申报设置失败", e).toString();
		}
	}

	/**
	 *
	 * 修改投资计划申报设置
	 * 
	 * @param jsonStr
	 *            入参
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/updateInvestPlanSet", method = RequestMethod.POST)
	public String updateInvestPlanSet(@RequestBody String jsonStr) throws Exception {
		if (logger.isInfoEnabled()) {
			logger.info("修改投资计划申报设置请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("修改投资计划申报设置请求json入参为空，请核查数据!");
			}
			String result = investOperSmo.updateInvestPlanSet(jsonStr);
			JSONObject jsonObj = JSONObject.fromObject(result);
			String resultCode = JsonUtil.getStringFromJSON(jsonObj, "resultCode", "");
			return ReturnsUtil.returnSuccess(new JSONObject()).toString();
			/*
			 * if (MDA.RESULT_SUCCESS.equals(resultCode)) { return result; }
			 * else { return
			 * ReturnsUtil.returnFailure(JsonUtil.obtainValueFromJsonObject(
			 * result, "message")); }
			 */
		} catch (BaseException e) {
			if (logger.isErrorEnabled()) {
				logger.error(e.getStackTrace());
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnException("修改投资计划申报设置失败", e).toString();
		}
	}

	/**
	 *
	 * 修改投资计划申报设置
	 *
	 * @param jsonStr
	 *            入参
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/updateInvestPlanSetByCondition", method = RequestMethod.POST)
	public String updateInvestPlanSetByCondition(@RequestBody String jsonStr) throws Exception {
		if (logger.isInfoEnabled()) {
			logger.info("修改投资计划申报设置请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("修改投资计划申报设置请求json入参为空，请核查数据!");
			}
			String result = investOperSmo.updateInvestPlanSetByCondition(jsonStr);
			JSONObject jsonObj = JSONObject.fromObject(result);
			String resultCode = JsonUtil.getStringFromJSON(jsonObj, "resultCode", "");
			return ReturnsUtil.returnSuccess(new JSONObject()).toString();
		} catch (BaseException e) {
			if (logger.isErrorEnabled()) {
				logger.error(e.getStackTrace());
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnException("修改投资计划申报设置失败", e).toString();
		}
	}

	/**
	 *
	 * 新增投资计划填报
	 * 
	 * @param jsonStr
	 *            入参
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/addInvestPlan", method = RequestMethod.POST)
	public String addInvestPlan(HttpServletRequest request, @RequestBody String jsonStr) throws Exception {
		if (logger.isInfoEnabled()) {
			logger.info("新增投资计划填报请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("新增投资计划填报请求json入参为空，请核查数据!");
			}
			HttpSession session = request.getSession();
			Staff staff = (Staff) session.getAttribute("loginedStaff");
			String result = investOperSmo.addInvestPlan(jsonStr, staff);
			return ReturnsUtil.returnSuccess(new JSONObject()).toString();
		} catch (BaseException e) {
			if (logger.isErrorEnabled()) {
				logger.error(e.getStackTrace());
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnException("新增投资计划填报失败", e).toString();
		}
	}

	/**
	 *
	 * 修改投资计划填报
	 * 
	 * @param jsonStr
	 *            入参
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/updateInvestPlan", method = RequestMethod.POST)
	public String updateInvestPlan(@RequestBody String jsonStr) throws Exception {
		if (logger.isInfoEnabled()) {
			logger.info("修改投资计划填报请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("修改投资计划填报请求json入参为空，请核查数据!");
			}
			String result = investOperSmo.updateInvestPlan(jsonStr);
			return ReturnsUtil.returnSuccess(new JSONObject()).toString();
			/*
			 * JSONObject jsonObj = JSONObject.fromObject(result); String
			 * resultCode = JsonUtil.getStringFromJSON(jsonObj, "resultCode",
			 * ""); if (MDA.RESULT_SUCCESS.equals(resultCode)) { return result;
			 * } else { return
			 * ReturnsUtil.returnFailure(JsonUtil.obtainValueFromJsonObject(
			 * result, "message")); }
			 */
		} catch (BaseException e) {
			if (logger.isErrorEnabled()) {
				logger.error(e.getStackTrace());
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnException("修改投资计划填报失败", e).toString();
		}
	}

	/**
	 *
	 * 投资计划--初审/批复
	 * 
	 * @param jsonStr
	 *            入参
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/trialInvestPlan", method = RequestMethod.POST)
	public String trialInvestPlan(@RequestBody String jsonStr) throws Exception {
		if (logger.isInfoEnabled()) {
			logger.info("投资计划初审请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("投资计划初审请求json入参为空，请核查数据!");
			}
			String result = investOperSmo.trialInvestPlan(jsonStr);
			JSONObject jsonObj = JSONObject.fromObject(result);
			String resultCode = JsonUtil.getStringFromJSON(jsonObj, "resultCode", "");
			return ReturnsUtil.returnSuccess(new JSONObject()).toString();
			/*
			 * if (MDA.RESULT_SUCCESS.equals(resultCode)) { return result; }
			 * else { return
			 * ReturnsUtil.returnFailure(JsonUtil.obtainValueFromJsonObject(
			 * result, "message")); }
			 */
		} catch (BaseException e) {
			if (logger.isErrorEnabled()) {
				logger.error(e.getStackTrace());
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnException("投资计划初审失败", e).toString();
		}
	}

	/**
	 * 批量审核或批复投资计划
	 * 
	 * @param jsonStr
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/batchTrialInvestPlan", method = RequestMethod.POST)
	public String batchTrialInvestPlan(@RequestBody String jsonStr) throws Exception {
		if (logger.isInfoEnabled()) {
			logger.info("投资计划初审请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("投资计划初审请求json入参为空，请核查数据!");
			}
			String result = investOperSmo.batchTrialInvestPlan(jsonStr);
			JSONObject jsonObj = JSONObject.fromObject(result);
			String resultCode = JsonUtil.getStringFromJSON(jsonObj, "resultCode", "");
			return ReturnsUtil.returnSuccess(new JSONObject()).toString();
		} catch (BaseException e) {
			if (logger.isErrorEnabled()) {
				logger.error(e.getStackTrace());
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnException("投资计划批量初审或批复失败", e).toString();
		}
	}

	/**
	 *
	 * 投资计划--统计
	 * 
	 * @param jsonStr
	 *            入参
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/queryInvestPlanStaticList", method = RequestMethod.POST)
	public String queryInvestPlanStaticList(@RequestBody String jsonStr) throws Exception {
		if (logger.isInfoEnabled()) {
			logger.info("投资计划统计请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("投资计划统计请求json入参为空，请核查数据!");
			}
			PageQuery<InvestStatic> result = investQuerySmo.queryInvestPlanStatic(jsonStr);
			return ReturnsUtil.returnSuccess(result).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}
	
	/**
	 *
	 *  删除投资计划申报设置
	 * @param investPlanSet 入参
	 * @return
	 * @throws Exception
	 */
	@PostMapping(value = "/deleteInvestPlanSet")
	public String deleteInvestPlanSet(@RequestBody PlanDeclareSet investPlanSet){
		if (logger.isInfoEnabled()) {
			logger.info("请求入参:{}", investPlanSet.toString());
		}
		try {
			if (investPlanSet == null || StringUtil.isEmpty(investPlanSet.getDeclareSetId())) {
				throw new BaseException("请求入参为空，请核查数据!");
			}
//			investOperSmo.deleteInvestPlanSet(investPlanSet);
			
			return ReturnsUtil.returnSuccess(new JSONObject()).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}


	/**
	 * 查询投机批复页面新接口
	 * @param jsonStr
	 * @return
	 */
	@RequestMapping(value = "/queryShInvestPlanListNew")
	public String queryShInvestPlanListNew(@RequestBody String jsonStr){
		if (logger.isInfoEnabled()) {
			logger.info("请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("请求入参为空，请核查数据!");
			}
			List<String> statusList=new  ArrayList<String>();
			statusList.add(String.valueOf(MDA.FUND_PLAN_STATUS_CD_FIR));
			PageQuery<InvestPlanRspVo> result = investQuerySmo.queryInvestPlanListNew(jsonStr,statusList);
			return ReturnsUtil.returnSuccess(result).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}


	/**
	 * 投资计划审批绿色通道
	 * @param jsonStr
	 * @return
	 */
	@RequestMapping(value = "/addInvestPlanGreen")
	public String addInvestPlanGreen(@RequestBody String jsonStr){
		if (logger.isInfoEnabled()) {
			logger.info("请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("请求入参为空，请核查数据!");
			}
			List<Integer> statusList=new  ArrayList<Integer>();
			statusList.add(MDA.FUND_PLAN_STATUS_CD_FIR);
			String string = investOperSmo.addInvestPlanGreen(jsonStr);
			return ReturnsUtil.returnSuccess(string).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}


	/**
	 * 投资计划审批绿色通道
	 * @param jsonStr
	 * @return
	 */
	@RequestMapping(value = "/queryInvestPlanForGreen")
	public String queryInvestPlanForGreen(@RequestBody String jsonStr){
		if (logger.isInfoEnabled()) {
			logger.info("请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("请求入参为空，请核查数据!");
			}
			InvestPlanRspVo vo = investQuerySmo.queryInvestPlanForGreen(jsonStr);
			return ReturnsUtil.returnSuccess(vo).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}

	/**
	 * 查询已初审或批复的项目列表
	 * 
	 * @param jsonStr
	 * @return
	 */
	@RequestMapping(value = "/queryExistedImpleProjList")
	public String queryExistedImpleProjList(@RequestBody String jsonStr) {
		if (logger.isInfoEnabled()) {
			logger.info("请求入参json:{}", jsonStr);
		}
		try {
			if (jsonStr == null || jsonStr.length() <= 0) {
				throw new BaseException("请求入参为空，请核查数据!");
			}
			List<String> list = investQuerySmo.queryExistedImpleProjList(jsonStr);
			return ReturnsUtil.returnSuccess(list).toString();
		} catch (Exception e) {
			if (logger.isErrorEnabled()) {
				logger.error(ReturnsUtil.getStackTrackMessage(e));
			}
			return ReturnsUtil.returnFailure(e.getMessage());
		}
	}
}
